/* SPDX-License-Identifier: GPL-2.0-or-later */
/* -*- mode: c; c-basic-offset: 8; -*-
 * vim: noexpandtab sw=8 ts=8 sts=0:
 *
 * Copyright (C) 2005 Oracle.  All rights reserved.
 */

#ifndef O2CLUSTER_QUORUM_H
#define O2CLUSTER_QUORUM_H

#define MAX_QUORUM_CHECK_TIME 120000  /* check at most 120s */
#define QUORUM_CHECK_TIME 2000  /* check every 2s */

void o2quo_init(void);
void o2quo_exit(void);

void o2quo_hb_up(u16 node, bool lock_type_adl);
void o2quo_hb_down(u16 node, bool lock_type_adl);
void o2quo_hb_still_up(u16 node);
void o2quo_conn_up(u16 node);
void o2quo_conn_err(u16 node);
void o2quo_disk_timeout(void);

int o2quo_make_decision(unsigned long hb_bm[], int hb_heartbeating,
		u16 hr_qs_effect_nodes[], u16 hr_qs_lowest_node[]);
int o2quo_conn_down(u16 node);
int o2quo_conn_check_err(u16 node);
u16 o2quo_calculate_effect_nodes(unsigned long hb_bm[], u16 node);
u16 o2quo_get_lowest_node(unsigned long hb_bm[], u16 node);

bool o2quo_conn_normal(unsigned long hb_bm[], u16 eff_nodes[]);

#endif /* O2CLUSTER_QUORUM_H */
